<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Listen美食城|美味小吃|营养丰富</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="format-detection" content="telephone=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="alternate icon" type="image/png" href="__PUBLIC__/vendor/assets/i/favicon.png">
    <link rel="stylesheet" href="__PUBLIC__/vendor/assets/css/amazeui.min.css"/>
    <style>
        .header {
            text-align: center;
        }

        .header h1 {
            font-size: 200%;
            color: #333;
            margin-top: 30px;
        }

        .header p {
            font-size: 14px;
        }
    </style>
</head>
<body>
<div class="header">
    <div class="am-g">
        <h1>Listen美食城后台修改密码页面</h1>
    </div>
    <hr/>
</div>
<div class="am-g">
    <div class="am-u-lg-4 am-u-md-6 am-u-sm-centered">
        <h3>修改密码</h3>
        <a href="{{:U('User/register')}}" class="am-btn am-btn-danger am-btn-sm"> 注册</a>
        <a href="{{:U('User/login')}}" class="am-btn am-btn-primary am-btn-sm"> 登录</a>
        <hr>

        <form class="am-form">
            <div class="am-input-group">
                <span class="am-input-group-label"><i class="am-icon-lock am-icon-fw"></i></span>
                <input type="password" id="password" class="am-form-field" placeholder="请输入新密码">
            </div>
            <br>
            <div class="am-input-group">
                <span class="am-input-group-label"><i class="am-icon-lock am-icon-fw"></i></span>
                <input type="password" id="check_password" class="am-form-field"
                       placeholder="请确认新密码">
            </div>
            </br>
            <div class="am-cf">
                <input type="submit" value="发 送" class="submit am-btn am-btn-primary am-btn-sm am-fl">
            </div>

        </form>
        <hr>
        <p>© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
    </div>
</div>
<script src="__PUBLIC__/vendor/assets/js/jquery.min.js"></script>
<script src="__PUBLIC__/vendor/assets/js/amazeui.min.js"></script>
<script>
    $(function () {
        $('.submit').click(function () {
            var info = {
                password: $("#password").val(),
                check_password: $("#check_password").val()
            };

            if (info.password.length < 6) {
                alert('密码最低6位');
                return false;
            }

            if (info.check_password.length < 6) {
                alert('确认密码最低6位');
                return false;
            }

            if (info.password != info.check_password) {
                alert('两次密码输入不一样');
                return false;
            }

            $.post("{{:U('User/doeditpwd')}}", info, function (data) {
                if (data.status == 1) {
                    alert(data.msg);
                    location.href = "{{:U('User/login')}}";
                } else {
                    alert(data.msg);
                }
            });
            return false;
        })
    })
</script>

</body>
</html>
